package com.ceair.flight.refund.location.dt.enums;

public enum PaymentStatusEnum {

    /**
     * 支付状态枚举
     */

    WAIT_FOR_PAY(10, "等待支付"),
    PAY_PROCESS(20, "支付中"),
    PAY_FAILURE(30, "支付失败"),
    PAY_SUCCESS(40, "支付成功"),
    ERROR_REFUND(50, "差错退款"),
    RISK_PROCESS(60, "风控人工审核中"),
    ERROR_PAYMENT(70, "差错支付");

    /**
     * 简码
     */
    private final Integer code;

    /**
     * 描述
     */
    private final String description;

    private PaymentStatusEnum(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    /**
     * @return Returns the code.
     */
    public Integer getCode() {
        return code;
    }

    /**
     * @return Returns the description.
     */
    public String getDescription() {
        return description;
    }

    /**
     * 通过枚举<code>code</code>获得枚举。
     *
     * @param code 简码
     * @return 枚举
     */
    public static PaymentStatusEnum getByCode(Integer code) {
        for (PaymentStatusEnum status : values()) {
            if (status.getCode().intValue() == code.intValue()) {
                return status;
            }
        }
        return null;
    }
}
